Skip to content

Replace FragmentedMapper with TwoLevelMmapper #1337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

wks
Copy link
Collaborator

@wks wks commented Jul 9, 2025

DRAFT:

  • Needs more correctness testing
  • Needs performance evaluation

This PR replaces FragmentedMapper with TwoLevelMmapper.

TwoLevelMmapper does not use hash tables. It is also lock-free when looking up MapState entries, and also lock-free when lazily initializing slabs. It is intended to eliminate the pathological case of FragmentedMapper where a hash collision can result in a long-distance linear scan and many locking operations.

Fixes: #1336

This is a replacement for `FragmentedMapper`.  It does not use hash
tables and is lock-free when looking up or lazily initializing the slabs
table.  It is intended to eliminate the pathological case of
`FragmentedMapper` where a hash collision can result in many locking
operations to find the matching or vacant slab table entry.
wks added 8 commits July 10, 2025 15:16
FragmentedMapper was FragmentedMmapper in JikesRVM.  FragmentedMapper
may be a misnomer introduced when porting it to Rust.
The hash table design should have been a mistake.  Now that we are going
to replace it, we replace it completely.
x86_64 actualy has 47 bit address space for the user.
The current implememntation only has two levels.  We leave the name
"MultiLevelMmapper" to a true multi-level implementation in the future.
@wks wks changed the title Add MultiLevelMapper Add TwoLevelMmapper Jul 11, 2025
@wks wks changed the title Add TwoLevelMmapper Replace FragmentedMapper with TwoLevelMmapper Jul 11, 2025
@wks
Copy link
Collaborator Author

wks commented Jul 11, 2025

This PR is intended as a quick fix for the pathological case of FragmentedMapper The newly added two_level_mmapper.rs inherits most of the code from FragmentedMapper, including both impl Mmapper for TwoLevelMmapper and the test cases. The impl Mmapper part should be as correct (or incorrect) as the FragmentedMapper, but I found that those parts have program logics of slab operations intermixed with (single-chunk or bulk) memory protection. I will refactor that part in another PR, and probably make TwoLevelMmapper share code with ByteMapMmapper.

@wks wks added the PR-extended-testing Run extended tests for the pull request label Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-extended-testing Run extended tests for the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inefficient locking in FragmentedMapper::get_or_optionally_allocate_slab_table
1 participant